package com.itheima.d2_collection_nesting;

import java.util.*;

/*
      目标：理解集合的嵌套。
      江苏省 = "南京市","扬州市","苏州市“,"无锡市","常州市"
      湖北省 = "武汉市","孝感市","十堰市","宜昌市","鄂州市"
      河北省 = "石家庄市","唐山市", "邢台市", "保定市", "张家口市"
 */
public class Test {
    public static void main(String[] args) {
        Map<String, Set<String>> map1 = new HashMap<>();
        Set<String> list1 = new HashSet<>();
        Collections.addAll(list1, "南京市", "扬州市", "苏州市", "无锡市", "常州市");
        map1.put("江苏省", list1);

        Map<String, Set> map2 = new HashMap<>();
        Set<String> list2 = new HashSet<>();
        Collections.addAll(list2, "武汉市", "孝感市", "十堰市", "宜昌市", "鄂州市");
        map2.put("湖北省", list2);

        Map<String, Set> map3 = new HashMap<>();
        Set<String> list3 = new HashSet<>();
        Collections.addAll(list3, "石家庄市", "唐山市", "邢台市", "保定市", "张家口市");
        map3.put("河北省", list3);

        map1.forEach((key, value) -> {
            System.out.print(key + "=");
            value.forEach((city) -> {
                System.out.print(city+"\t");
            });
            System.out.println();
        });

        map2.forEach((key, value) -> {
            System.out.print(key + "=");
            value.forEach((city) -> {
                System.out.print(city+"\t");
            });
            System.out.println();
        });

        map3.forEach((key, value) -> {
            System.out.print(key + "=");
            value.forEach((city) -> {
                System.out.print(city+"\t");
            });
            System.out.println();
        });
    }

}
